const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  token: state => state.user.token,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  roles: state => state.user.roles,
  isAdmin: state => {
    return state.user.roles.some(role => {
      const normalizedRole = role.toLowerCase().replace('role_', '')
      return normalizedRole === 'admin'
    })
  },
  isUser: state => {
    return state.user.roles.some(role => {
      const normalizedRole = role.toLowerCase().replace('role_', '')
      return normalizedRole === 'user'
    })
  },
  announcements: state => state.announcement.announcements
}
export default getters
